package com.yfqy.admin.util;

import com.yfqy.admin.enums.ResponseEnum;
import com.yfqy.admin.exception.BaseException;

/**
 * @Author: 梁二东
 * @Date: 2025/5/6 17:36
 * @Description:
 **/
public class ExceptionTool {

    public static void throwException(String message) {
        throw new BaseException(ResponseEnum.BAD_REQUEST.getCode(), message, "", "");
    }

    public static void throwException(Integer code, String message) {
        throw new BaseException(code, message, "", "");
    }

    public static void throwException(boolean throwException, String message) {
        if (throwException) {
            throw new BaseException(ResponseEnum.BAD_REQUEST.getCode(), message, "", "");
        }
    }

    public static void throwException(ResponseEnum exceptionEnum) {
        throw BaseException.fail(exceptionEnum);
    }

}
